package com.icloud.cer.rest.test.bean;

import java.io.IOException;

import com.icloud.cer.rest.Constants;
import com.icloud.cer.rest.msg.AbsMsgObject;
import com.icloud.cer.rest.msg.BDataFilterInputStream;
import com.icloud.cer.rest.msg.DataFilterOutputStream;

public class RegistClientInfo  extends AbsMsgObject<RegistClientInfo>{

	public static final int BYTE_COUNT = 96;
	private byte[] encryptorName ;//64
	private byte[] encryptorId;//32
	private int loginRet; 

	private String encryptorNameStr;
	private String encryptorIdStr;
	

	public byte[] getEncryptorName() {
		return encryptorName;
	}

	public void setEncryptorName(byte[] encryptorName) {
		this.encryptorName = encryptorName;
	}

	public byte[] getEncryptorId() {
		return encryptorId;
	}

	public void setEncryptorId(byte[] encryptorId) {
		this.encryptorId = encryptorId;
	}
	
	public int getLoginRet() {
		return loginRet;
	}
	
	public void setLoginRet(int loginRet) {
		this.loginRet = loginRet;
	}

	public String getEncryptorNameStr() {
		return encryptorNameStr;
	}

	public void setEncryptorNameStr(String encryptorNameStr) {
		this.encryptorNameStr = encryptorNameStr;
	}

	public String getEncryptorIdStr() {
		return encryptorIdStr;
	}

	public void setEncryptorIdStr(String encryptorIdStr) {
		this.encryptorIdStr = encryptorIdStr;
	}


	@Override
	protected void doSerialize(DataFilterOutputStream dos) throws IOException {
		dos.writeBytes(new String(encryptorNameStr.getBytes(),Constants.CHARSET));
		
		int remainderLen = 64 - encryptorNameStr.length();
		if(remainderLen > 0) {
			dos.writeBytes(new String(new byte[remainderLen],Constants.CHARSET));
		}
		
		dos.writeBytes(encryptorIdStr);
		remainderLen = 32 - encryptorIdStr.length();
		if(remainderLen > 0) {
			dos.writeBytes(new String(new byte[remainderLen],Constants.CHARSET));
		}
	}

	@Override
	protected RegistClientInfo doDeserialize(BDataFilterInputStream dis) throws IOException {
		return this;
	}
}
